iT邦幫忙

2021 iThome 鐵人賽

DAY 29
2

有點悲劇的發現把busybox的hwclock順好是沒有用的。

hwclock建基於必須要有一個真的RTC (Real Time Clock)裝置這一個事實,而我之前一直有一個錯誤的印象是LiteX SoC上有RTC,但其實這部份LiteX是平台相依的,他有一個LiteMMCM、這個是基於Xilinx的hardIP去作再包裝出來。我的板子選的是Lattice FPGA的,自然沒有這個選擇,也就沒有RTC可以用了QAQ

不過還是可以紀錄一下中間發生的事情,那就是RTC的開啟在:
Device Driver => RTC Drivers ,才會把RTC subsystem打起來。

我原本是想蒐羅看看有沒有可能RISC-V有一些比較漂亮的workaround,例如打SBI call去拿mtime/mtimecmp去兜之類的。但是似乎沒這種東西......

於是我決定隨便從google來的github code惡搞一個出來!
https://gist.github.com/Ruinland/362eb9dc65615b076b098ddb507f07d8

火速放進kernel tree裡面給它重編,丟上板子:

[   17.485896] rtc-fake rtc-fake: registered as rtc0
[   17.494276] rtc-fake rtc-fake: setting system clock to 1970-01-01T00:01:40 UTC (100)
[   17.504262] rtc-fake rtc-fake: loaded; begtime is 17, time is 100

然後就會看到hwclock拿他來用了XDDDD

 * Setting system clock using the hardware clock [UTC] ...
...
 * Starting busybox syslog ... [ ok ]

反正鐵人賽就像hackathon一樣,我們要tidy up可以等以後再說wwwwwwwww


上一篇
Alpine Linux Porting (2.1) clock is _not_ ticking
下一篇
Wrap-up : Alpine Linux on LiteX/VexRiscv
系列文
Port Alpine Linux to open source RISC-V platform30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 則留言

0
高魁良
iT邦新手 2 級 ‧ 2021-10-08 21:34:32

這篇讓我笑開懷

我要留言

立即登入留言